package com.ctshk.rpc.scenic.generator;

import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.ctshk.common.utils.DateUtil;

import java.time.LocalDateTime;

public class Httpclient {

    public static void main(String[] args) {
        JSONObject param = new JSONObject();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("agentId", "AT000005639");
        jsonObject.put("requestTime", DateUtil.fmt(LocalDateTime.now()));
        String mesage = jsonObject.toJSONString();
        String key = "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJBVDAwMDAwNTYzOSIsImNyZWF0ZWQiOjE0Nzk3MDg2ODExMzIsImV4cCI6MTQ4MDMxMzQ4MX0.4U5Vjs2s9qwfy1vK2AL2iBH099MToV2dIlzvX_3Quy9CaHdGWwebuZ5L2ryIwPiuBnFw-EsjHPpedLRMTv4SPg";
        String signature = SHA256Util.getSHA256String(mesage + "||" + key);
        param.put("message", jsonObject);
        param.put("signature", signature);
        try {
            String result = HttpUtil.post("https://otasuat.oceanpark.com.hk/otas-api/OTA/GetEvents", param);
            System.out.println(result);
        } catch (Exception e) {
            return;
        }

    }
}
